package com.app.qbake.module.square;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;

import com.wind.base.mvp.view.TabLayoutFragment;
import com.wind.data.square.SquareRequest;
import com.app.qbake.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wind on 2018/10/28.
 */

public class SearchGoodsListTabFragment extends TabLayoutFragment {
    private static final String ARGS_KEY_KEYWORDS = "args_key_keywords";

    @Override
    public int getLayoutRes() {
        return R.layout.fragment_my_goods_tab;
    }
    String keywords;

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        keywords=getArguments().getString(ARGS_KEY_KEYWORDS);
        super.onViewCreated(view, savedInstanceState);
    }

    @Override
    public List<String> getTitles() {
        List<String> titles=new ArrayList<>();
        titles.add("最新");
        titles.add("热门");
        return titles;
    }

    @Override
    protected List<Fragment> getFragments() {
        List<Fragment> fragments=new ArrayList<>();
        fragments.add(SquareFragment.getInstance(SquareRequest.TYPE_NEW,keywords));
        fragments.add(SquareFragment.getInstance(SquareRequest.TYPE_HOT,keywords));
        return fragments;
    }

    public static Fragment getInstance(String keywords){
        SearchGoodsListTabFragment f=new SearchGoodsListTabFragment();
        Bundle args=new Bundle();
        args.putString(ARGS_KEY_KEYWORDS,keywords);
        f.setArguments(args);
        return f;

    }
}
